<template>
	<view class="listContent">
		<v-header>
			<view slot="middle">
				项目列表
			</view>
		</v-header>
		<uni-search-bar placeholder="输入编号/名称搜索" @confirm="search" @input="input" radius="100 "></uni-search-bar>
		<block v-for="(item,index) in projList" :key="index">
			<view class="listItem" @click="toProj(index)">
				<view class="listItem-top">
					<view>{{item.prjName}}</view>
					<view>详细信息<image src="../../../static/view/右箭头.png"></image>
					</view>
				</view>
				<view class="listItem-middle">
					<image src="../../../static/view/icon.png"></image>
					<view class="listItem-middle-info">
						<text>负责人: {{item.projectManagerFullname}}</text>
						<text>13145200000</text>
						<text>{{item.finishDate}}</text>
					</view>
				</view>
			</view>
		</block>
	</view>
</template>
<script>
	import {
		uniSection,
		uniSearchBar
	} from '@dcloudio/uni-ui'
	import vHeader from '../../../components/header.vue'
	export default {
		data() {
			return {
				XToken: this.$store.state.user.result.token,
				projList: []
			}
		},
		components: {
			uniSection,
			uniSearchBar,
			vHeader
		},
		methods: {
			//跳转至项目详情
			toProj(index) {
				let params = {
					prjName: this.projList[index].prjName,
					createTime: this.projList[index].createTime,
					projectManagerFullname: this.projList[index].projectManagerFullname,
					status: this.projList[index].status,
					prjCode: this.projList[index].prjCode
				}
				//传参
				uni.navigateTo({
					url: '../projinfo/projinfo?projinfo='+ JSON.stringify(params)
				})
			}
		},
		onLoad() {
			let that = this
			uni.request({
				url: this.baseUrl + 'project/sysProject/listByUser',
				method: 'GET',
				header: {
					'X-Access-Token': this.XToken
				},
				success(res) {
					console.log(res)
					that.projList = res.data.result.records
				}
			})
		}
	}
</script>

<style lang="scss">
	.listContent {
		background: #f7f7f7;
		width: 100%;
		height: 100vh;
	}

	.header-back {
		display: block;
		width: 18px;
		height: 18px;
	}

	.listItem {
		margin: 0 15px;
		background: #fff;
		margin-top: 12px;
		padding-bottom: 23.5px;

		&-top {
			display: flex;
			justify-content: space-between;
			font-size: 12px;
			color: #999;

			// 标题
			view:nth-child(1) {
				font-size: 17px;
				font-weight: bold;
				color: #333;
				margin-top: 14px;
				margin-left: 13.5px;
			}

			// 详情
			view:nth-child(2) {
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin-top: 19px;
				margin-right: 18px;

				image {
					display: block;
					width: 4.5px;
					height: 8px;
					margin-left: 7px;
				}
			}
		}

		&-middle {
			display: flex;
			margin-top: 28px;
			margin-left: 13.5px;

			image {
				display: block;
				width: 72px;
				height: 72px;
			}

			&-info {
				position: relative;
				display: flex;
				flex-direction: column;
				margin-left: 22px;

				text:nth-child(3) {
					font-size: 11px;
					color: #bbb;
					position: absolute;
					bottom: 0;
				}
			}

		}
	}
</style>
